home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / unsupprt / guide / src / libguide / guide.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  26.1 KB  |  1,650 lines

  1. /*
  2.  * This file is a product of Sun Microsystems, Inc. and is provided for
  3.  * unrestricted use provided that this legend is included on all tape
  4.  * media and as a part of the software program in whole or part.  Users
  5.  * may copy or modify this file without charge, but are not authorized to
  6.  * license or distribute it to anyone else except as part of a product
  7.  * or program developed by the user.
  8.  * 
  9.  * THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  10.  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  11.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  12.  * 
  13.  * This file is provided with no support and without any obligation on the
  14.  * part of Sun Microsystems, Inc. to assist in its use, correction,
  15.  * modification or enhancement.
  16.  * 
  17.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  18.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE
  19.  * OR ANY PART THEREOF.
  20.  * 
  21.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  22.  * or profits or other special, indirect and consequential damages, even
  23.  * if Sun has been advised of the possibility of such damages.
  24.  * 
  25.  * Sun Microsystems, Inc.
  26.  * 2550 Garcia Avenue
  27.  * Mountain View, California  94043
  28.  */
  29.  
  30. #ifndef lint
  31. static char     sccsid[] = "@(#)guide.c    2.34 91/10/15 Copyright 1989 Sun Microsystems";
  32. #endif
  33.  
  34. #include "guide.h"
  35.  
  36. /*
  37.  * Table of attribute name strings indexed by attribute.  The entries in this
  38.  * table must match G_ATTRS.
  39.  */
  40. static char    *attr_string[] =
  41. {
  42.     ":actions",
  43.     ":anchor-object",
  44.     ":anchor-point",
  45.     ":background-color",
  46.     ":busy-drop-glyph",
  47.     ":button-type",
  48.     ":choices",
  49.     ":choice-defaults",
  50.     ":choice-label-types",
  51.     ":choice-colors",
  52.     ":columns",
  53.     ":column-alignment",
  54.     ":connections",
  55.     ":constant-width",
  56.     ":default-drop-site",
  57.     ":dnd-accept-cursor",
  58.     ":dnd-accept-cursor-xhot",
  59.     ":dnd-accept-cursor-yhot",
  60.     ":dnd-cursor",
  61.     ":dnd-cursor-xhot",
  62.     ":dnd-cursor-yhot",
  63.     ":draggable",
  64.     ":done-handler",
  65.     ":droppable",
  66.     ":drop-target_width",
  67.     ":drawing-model",
  68.     ":events",
  69.     ":event-handler",
  70.     ":foreground-color",
  71.     ":group-type",
  72.     ":height",
  73.     ":help",
  74.     ":horizontal-offset",
  75.     ":horizontal-scrollbar",
  76.     ":horizontal-spacing",
  77.     ":icon-file",
  78.     ":icon-label",
  79.     ":icon-mask-file",
  80.     ":initial-list-glyphs",
  81.     ":initial-list-values",
  82.     ":initial-selections",
  83.     ":initial-state",
  84.     ":initial-value",
  85.     ":international-db-begin",
  86.     ":international-db-end",
  87.     ":label",
  88.     ":label-type",
  89.     ":label-bold",
  90.     ":layout-type",
  91.     ":mapped",
  92.     ":max-tick-string",
  93.     ":max-value",
  94.     ":max-value-string",
  95.     ":members",
  96.     ":menu-handler",
  97.     ":menu-item-colors",
  98.     ":menu-item-defaults",
  99.     ":menu-item-handlers",
  100.     ":menu-item-labels",
  101.     ":menu-item-label-types",
  102.     ":menu-item-menus",
  103.     ":menu-item-states",
  104.     ":menu",
  105.     ":menu-title",
  106.     ":menu-type",
  107.     ":min-tick-string",
  108.     ":min-value",
  109.     ":min-value-string",
  110.     ":multiple-selections",
  111.     ":name",
  112.     ":normal-drop-glyph",
  113.     ":notify-handler",
  114.     ":orientation",
  115.     ":owner",
  116.     ":pinnable",
  117.     ":pinned",
  118.     ":read-only",
  119.     ":reference-point",
  120.     ":repaint-proc",
  121.     ":resizable",
  122.     ":rows",
  123.     ":row-alignment",
  124.     ":scrollable-height",
  125.     ":scrollable-width",
  126.     ":selection-required",
  127.     ":setting-type",
  128.     ":show-border",
  129.     ":show-endboxes",
  130.     ":show-footer",
  131.     ":show-range",
  132.     ":show-value",
  133.     ":slider-width",
  134.     ":stored-length",
  135.     ":text-type",
  136.     ":ticks",
  137.     ":title",
  138.     ":type",
  139.     ":user-data",
  140.     ":value-length",
  141.     ":value-underlined",
  142.     ":value-x",
  143.     ":value-y",
  144.     ":vertical-offset",
  145.     ":vertical-scrollbar",
  146.     ":vertical-spacing",
  147.     ":width",
  148.     ":x",
  149.     ":y",
  150.     0,
  151. };
  152.  
  153.  
  154. /*
  155.  * The actions strings.
  156.  * The order of these strings must match that in G_ACTION_ATTRS.
  157.  */
  158. static char    *action_attr_string[] =
  159. {
  160.     ":from",
  161.     ":when",
  162.     ":to",
  163.     ":function_type",
  164.     ":arg_type",
  165.     ":action",
  166.     0,
  167. };
  168.  
  169.  
  170. /*
  171.  * Table of attribute name strings indexed by attribute.  The entries
  172.  * in this table must match G_PROJ_ATTRIS.
  173.  */
  174. static char    *proj_attr_string[] =
  175. {
  176.     ":interfaces",
  177.     ":actions",
  178.     ":root_window",
  179.     0,
  180. };
  181.  
  182.  
  183. /*
  184.  * Table of attribute name strings indexed by attribute.  The entries
  185.  * in this table must match G_RESFILE_ATTRS.
  186.  */
  187. static char    *resfile_attr_string[] =
  188. {
  189.     ":type",
  190.     ":events",
  191.     ":actions",
  192.     ":receivers",
  193.     0,
  194. };
  195.  
  196.  
  197. /*
  198.  * Table of argument type strings indexed by argument type.  The
  199.  * entries in this table must match G_ARG_TYPES.
  200.  */
  201. static char    *arg_type_string[] =
  202. {
  203.     ":void",
  204.     ":integer",
  205.     ":float",
  206.     ":string",
  207.     0,
  208. };
  209.  
  210. /*
  211.  * Table of function type strings indexed by argument type.  The
  212.  * entries in this table must match G_FUNC_TYPES.
  213.  */
  214. static char    *func_type_string[] =
  215. {
  216.     ":user-defined",
  217.     ":function",
  218.     ":code",
  219.     0,
  220. };
  221.  
  222. /*
  223.  * Table of Initial State strings indexed by argument type.  The
  224.  * entries in this table must match G_INITIAL_STATES.
  225.  */
  226. static char    *initial_state_string[] =
  227. {
  228.     ":active",
  229.     ":iconic",
  230.     ":inactive",
  231.     ":invisible",
  232.     ":notselected",
  233.     ":open",
  234.     ":selected",
  235.     ":visible",
  236.     0,
  237. };
  238.  
  239. /*
  240.  * Table of button name strings indexed by button type.  The entries in this
  241.  * table must match G_BUTTON_TYPES.
  242.  */
  243. static char    *button_type_string[] =
  244. {
  245.     ":normal",
  246.     ":abbreviated",
  247.     0,
  248. };
  249.  
  250. /*
  251.  * Table of drawing model strings indexed by drawing model.  The entries in
  252.  * this table must match G_DRAWING_MODELS.
  253.  */
  254. static char    *drawing_model_string[] =
  255. {
  256.     ":xview",
  257.     ":xwindows",
  258.     ":postscript",
  259.     0,
  260. };
  261.  
  262. /*
  263.  * Table of event name strings indexed by event type.  The entries in this
  264.  * table must match G_EVENT_TYPES.
  265.  */
  266. static char    *event_type_string[] =
  267. {
  268.     ":keyboard",
  269.     ":keyboard-left",
  270.     ":keyboard-right",
  271.     ":keyboard-top",
  272.     ":mouse",
  273.     ":mouse-drag",
  274.     ":mouse-enter",
  275.     ":mouse-exit",
  276.     ":mouse-move",
  277.     0,
  278. };
  279.  
  280. /*
  281.  * Table of label name strings indexed by layout type.  The entries in this
  282.  * table must match G_LABEL_TYPES.
  283.  */
  284. static char    *label_type_string[] =
  285. {
  286.     ":string",
  287.     ":glyph",
  288.     0,
  289. };
  290.  
  291. /*
  292.  * Table of menu name strings indexed by menu type.  The entries in this
  293.  * table must match G_MENU_TYPES.
  294.  */
  295. static char    *menu_type_string[] =
  296. {
  297.     ":command",
  298.     ":exclusive",
  299.     ":nonexclusive",
  300.     0,
  301. };
  302.  
  303. /*
  304.  * Table of layout name strings indexed by attribute.  The entries in this
  305.  * table must match G_LAYOUT_TYPE.
  306.  */
  307. static char    *layout_type_string[] =
  308. {
  309.     ":horizontal",
  310.     ":vertical",
  311.     0,
  312. };
  313.  
  314. /*
  315.  * Table of group type name strings indexed by attribute.  The entries in this
  316.  * table must match G_GROUP_TYPE.
  317.  */
  318. static char    *group_type_string[] =
  319. {
  320.     "nil",
  321.     ":row",
  322.     ":column",
  323.     ":row-column",
  324.     0,
  325. };
  326.  
  327. /*
  328.  * Table of compass points.  The entries in this table must match
  329.  * G_COMPASS_POINTS.
  330.  */
  331. static char    *compass_point_string[] =
  332. {
  333.     ":north-west",
  334.     ":north",
  335.     ":north-east",
  336.     ":west",
  337.     ":center",
  338.     ":east",
  339.     ":south-west",
  340.     ":south",
  341.     ":south-east",
  342.     0,
  343. };
  344.  
  345. /*
  346.  * Table of column alignment types.  The entries in this table must match
  347.  * G_COL_ALIGNMENTS.
  348.  */
  349. static char    *col_alignment_string[] =
  350. {
  351.     ":left-edges",
  352.     ":labels",
  353.     ":vertical-centers",
  354.     ":right-edges",
  355.     0,
  356. };
  357.  
  358. /*
  359.  * Table of row alignment types.  The entries in this table must match
  360.  * G_ROW_ALIGNMENTS.
  361.  */
  362. static char    *row_alignment_string[] =
  363. {
  364.     ":top-edges",
  365.     ":horizontal-centers",
  366.     ":bottom-edges",
  367.     0,
  368. };
  369.  
  370. /*
  371.  * Setting types.
  372.  */
  373. static char    *setting_type_string[] =
  374. {
  375.     ":exclusive",
  376.     ":nonexclusive",
  377.     ":check",
  378.     ":stack",    /* MOOSE - can this be changed to ":setting-stack"? */
  379.     0,
  380. };
  381.  
  382. /*
  383.  * Text types.
  384.  */
  385. static char    *text_type_string[] =
  386. {
  387.     ":alphanumeric",
  388.     ":multiline",
  389.     ":numeric",
  390.     0,
  391. };
  392.  
  393. /*
  394.  * Table of object type name strings indexed by object type.  The entries in
  395.  * this table must match G_TYPES.
  396.  */
  397. static char    *type_string[] =
  398. {
  399.     ":base-window",
  400.     ":button",
  401.     ":canvas-pane",
  402.     ":control-area",
  403.     ":drop-target",
  404.     ":gauge",
  405.     ":group",
  406.     ":menu",
  407.     ":menu-items",
  408.     ":message",
  409.     ":popup-window",
  410.     ":scrolling-list",
  411.     ":setting",
  412.     ":setting-items",
  413.     ":slider",
  414.     ":stack",
  415.     ":term-pane",
  416.     ":text-field",
  417.     ":text-pane",
  418.     0,
  419. };
  420.  
  421. /*
  422.  * Internal procedure declarations.
  423.  */
  424. int             lookup();
  425.  
  426. /*
  427.  * Return a list of object attributes for the specified object type.
  428.  */
  429. G_ATTRS        *
  430. #ifdef __STDC__
  431. G_object_attrs(G_TYPES type)
  432. #else
  433. G_object_attrs(type)
  434.     G_TYPES         type;
  435. #endif
  436. {
  437.     switch (type)
  438.     {
  439.     case G_BASE_WINDOW:
  440.     {
  441.         static G_ATTRS  attrs[] =
  442.         {
  443.             G_TYPE,
  444.             G_NAME,
  445.             G_OWNER,
  446.             G_INTERNATIONAL_DB_BEGIN,
  447.             G_WIDTH,
  448.             G_HEIGHT,
  449.             G_INTERNATIONAL_DB_END,
  450.             G_BACKGROUND_COLOR,
  451.             G_FOREGROUND_COLOR,
  452.             G_LABEL,
  453.             G_LABEL_TYPE,
  454.             G_MAPPED,
  455.             G_INITIAL_STATE,
  456.             G_SHOW_FOOTER,
  457.             G_RESIZABLE,
  458.             G_ICON,
  459.             G_ICON_LABEL,
  460.             G_ICON_MASK,
  461.             G_EVENT_HANDLER,
  462.             G_EVENTS,
  463.             G_USER_DATA,
  464.             G_ACTIONS,
  465.             -1,
  466.         };
  467.         
  468.         return attrs;
  469.     }
  470.         
  471.     case G_BUTTON:
  472.     {
  473.         static G_ATTRS  attrs[] =
  474.         {
  475.             G_TYPE,
  476.             G_NAME,
  477.             G_OWNER,
  478.             G_HELP,
  479.             G_INTERNATIONAL_DB_BEGIN,
  480.             G_X,
  481.             G_Y,
  482.             G_WIDTH,
  483.             G_HEIGHT,
  484.             G_CONSTANT_WIDTH,
  485.             G_INTERNATIONAL_DB_END,
  486.             G_BUTTON_TYPE,
  487.             G_FOREGROUND_COLOR,
  488.             G_LABEL,
  489.             G_LABEL_TYPE,
  490.             G_INITIAL_STATE,
  491.             G_MENU_NAME,
  492.             G_NOTIFY_HANDLER,
  493.             G_EVENT_HANDLER,
  494.             G_EVENTS,
  495.             G_USER_DATA,
  496.             G_ACTIONS,
  497.             -1,
  498.         };
  499.         
  500.         return attrs;
  501.     }
  502.         
  503.     case G_CANVAS_PANE:
  504.     {
  505.         static G_ATTRS  attrs[] =
  506.         {
  507.             G_TYPE,
  508.             G_NAME,
  509.             G_OWNER,
  510.             G_HELP,
  511.             G_INTERNATIONAL_DB_BEGIN,
  512.             G_X,
  513.             G_Y,
  514.             G_WIDTH,
  515.             G_HEIGHT,
  516.             G_INTERNATIONAL_DB_END,
  517.             G_BACKGROUND_COLOR,
  518.             G_FOREGROUND_COLOR,
  519.             G_INITIAL_STATE,
  520.             G_DRAGGABLE,
  521.             G_DROPPABLE,
  522.             G_DEFAULT_DROP_SITE,
  523.             G_MENU_NAME,
  524.             G_HSCROLL,
  525.             G_SCROLLABLE_WIDTH,
  526.             G_VSCROLL,
  527.             G_SCROLLABLE_HEIGHT,
  528.             G_REPAINT_PROC,
  529.             G_EVENT_HANDLER,
  530.             G_EVENTS,
  531.             G_DRAWING_MODEL,
  532.             G_USER_DATA,
  533.             G_ACTIONS,
  534.             -1,
  535.         };
  536.         
  537.         return attrs;
  538.     }
  539.  
  540.     case G_CONTROL_AREA:
  541.     {
  542.         static G_ATTRS  attrs[] =
  543.         {
  544.             G_TYPE,
  545.             G_NAME,
  546.             G_OWNER,
  547.             G_HELP,
  548.             G_INTERNATIONAL_DB_BEGIN,
  549.             G_X,
  550.             G_Y,
  551.             G_WIDTH,
  552.             G_HEIGHT,
  553.             G_INTERNATIONAL_DB_END,
  554.             G_BACKGROUND_COLOR,
  555.             G_FOREGROUND_COLOR,
  556.             G_INITIAL_STATE,
  557.             G_SHOW_BORDER,
  558.             G_MENU_NAME,
  559.             G_EVENT_HANDLER,
  560.             G_EVENTS,
  561.             G_USER_DATA,
  562.             G_ACTIONS,
  563.             -1,
  564.         };
  565.         return attrs;
  566.     }
  567.  
  568.     case G_DROP_TARGET:
  569.     {
  570.         static G_ATTRS  attrs[] =
  571.         {
  572.             G_TYPE,
  573.             G_NAME,
  574.             G_OWNER,
  575.             G_HELP,
  576.             G_INTERNATIONAL_DB_BEGIN,
  577.             G_X,
  578.             G_Y,
  579.             G_WIDTH,
  580.             G_HEIGHT,
  581.             G_DROP_TARGET_WIDTH,
  582.             G_INTERNATIONAL_DB_END,
  583.             G_DEFAULT_DROP_SITE,
  584.             G_DRAGGABLE,
  585.             G_DROPPABLE,
  586.             G_LABEL,
  587.             G_LABEL_TYPE,
  588.             G_NORMAL_DROP_GLYPH,
  589.             G_BUSY_DROP_GLYPH,
  590.             G_DND_CURSOR,
  591.             G_DND_CURSOR_XHOT,
  592.             G_DND_CURSOR_YHOT,
  593.             G_DND_ACCEPT_CURSOR,
  594.             G_DND_ACCEPT_CURSOR_XHOT,
  595.             G_DND_ACCEPT_CURSOR_YHOT,
  596.             G_FOREGROUND_COLOR,
  597.             G_INITIAL_STATE,
  598.             G_NOTIFY_HANDLER,
  599.             G_EVENT_HANDLER,
  600.             G_EVENTS,
  601.             G_USER_DATA,
  602.             G_ACTIONS,
  603.             -1,
  604.         };
  605.         
  606.         return attrs;
  607.     }
  608.  
  609.     case G_GAUGE:
  610.     {
  611.         static G_ATTRS  attrs[] =
  612.         {
  613.             G_TYPE,
  614.             G_NAME,
  615.             G_OWNER,
  616.             G_HELP,
  617.             G_INTERNATIONAL_DB_BEGIN,
  618.             G_X,
  619.             G_Y,
  620.             G_WIDTH,
  621.             G_HEIGHT,
  622.             G_VALUE_X,
  623.             G_VALUE_Y,
  624.             G_SLIDER_WIDTH,
  625.             G_TICKS,
  626.             G_INTERNATIONAL_DB_END,
  627.             G_FOREGROUND_COLOR,
  628.             G_LABEL,
  629.             G_LABEL_TYPE,
  630.             G_LAYOUT_TYPE,
  631.             G_ORIENTATION,
  632.             G_SHOW_RANGE,
  633.             G_MIN_VALUE,
  634.             G_MAX_VALUE,
  635.             G_MIN_TICK_STRING,
  636.             G_MAX_TICK_STRING,
  637.             G_INITIAL_VALUE,
  638.             G_INITIAL_STATE,
  639.             G_EVENT_HANDLER,
  640.             G_EVENTS,
  641.             G_USER_DATA,
  642.             G_ACTIONS,
  643.             -1,
  644.         };
  645.         
  646.         return attrs;
  647.     }
  648.  
  649.     case G_GROUP:
  650.     {
  651.         static G_ATTRS  attrs[] =
  652.         {
  653.             G_TYPE,
  654.             G_NAME,
  655.             G_X,
  656.             G_Y,
  657.             G_GROUP_TYPE,
  658.             G_MEMBERS,
  659.             G_ROWS,
  660.             G_ROW_ALIGNMENT,
  661.             G_COLUMNS,
  662.             G_COL_ALIGNMENT,
  663.             G_HSPACING,
  664.             G_VSPACING,
  665.             G_ANCHOR_OBJECT,
  666.             G_ANCHOR_POINT,
  667.             G_REFERENCE_POINT,
  668. /* MOOSE, JI18N - should this be part of groups???
  669.             G_INTERNATIONAL_DB_BEGIN,
  670.             G_INTERNATIONAL_DB_END,
  671. */
  672.             G_HOFFSET,
  673.             G_VOFFSET,
  674.             G_USER_DATA,
  675.             G_ACTIONS,
  676.             -1,
  677.         };
  678.         
  679.         return attrs;
  680.     }
  681.  
  682.     case G_MENU:
  683.     {
  684.         static G_ATTRS    attrs[] =
  685.         {
  686.             G_TYPE,
  687.             G_NAME,
  688.             G_HELP,
  689.             G_COLUMNS,
  690.             G_MENU_TYPE,
  691.             G_MENU_HANDLER,
  692.             G_MENU_TITLE,
  693.             G_MENU_ITEM_LABELS,
  694.             G_MENU_ITEM_LABEL_TYPES,
  695.             G_MENU_ITEM_STATES,
  696.             G_MENU_ITEM_DEFAULTS,
  697.             G_INITIAL_SELECTIONS,
  698.             G_MENU_ITEM_HANDLERS,
  699.             G_MENU_ITEM_MENUS,
  700.             G_MENU_ITEM_COLORS,
  701.             G_PINNABLE,        /* must follow G_MENU_ITEM_* */
  702.             G_USER_DATA,
  703.             G_ACTIONS,
  704.             -1,
  705.         };
  706.         return attrs;
  707.     }
  708.  
  709.     case G_MESSAGE:
  710.     {
  711.         static G_ATTRS  attrs[] =
  712.         {
  713.             G_TYPE,
  714.             G_NAME,
  715.             G_OWNER,
  716.             G_HELP,
  717.             G_INTERNATIONAL_DB_BEGIN,
  718.             G_X,
  719.             G_Y,
  720.             G_WIDTH,
  721.             G_HEIGHT,
  722.             G_INTERNATIONAL_DB_END,
  723.             G_FOREGROUND_COLOR,
  724.             G_LABEL,
  725.             G_LABEL_TYPE,
  726.             G_LABEL_BOLD,
  727.             G_INITIAL_STATE,
  728.             G_EVENT_HANDLER,
  729.             G_EVENTS,
  730.             G_USER_DATA,
  731.             G_ACTIONS,
  732.             -1,
  733.         };
  734.         
  735.         return attrs;
  736.     }
  737.  
  738.     case G_POPUP_WINDOW:
  739.     {
  740.         static G_ATTRS  attrs[] =
  741.         {
  742.             G_TYPE,
  743.             G_NAME,
  744.             G_OWNER,
  745.             G_INTERNATIONAL_DB_BEGIN,
  746.             G_WIDTH,
  747.             G_HEIGHT,
  748.             G_INTERNATIONAL_DB_END,
  749.             G_BACKGROUND_COLOR,
  750.             G_FOREGROUND_COLOR,
  751.             G_LABEL,
  752.             G_LABEL_TYPE,
  753.             G_MAPPED,
  754.             G_INITIAL_STATE,
  755.             G_SHOW_FOOTER,
  756.             G_RESIZABLE,
  757.             G_PINNED,
  758.             G_DONE_HANDLER,
  759.             G_EVENT_HANDLER,
  760.             G_EVENTS,
  761.             G_USER_DATA,
  762.             G_ACTIONS,
  763.             -1,
  764.         };
  765.         
  766.         return attrs;
  767.     }
  768.  
  769.     case G_SCROLLING_LIST:
  770.     {
  771.         static G_ATTRS  attrs[] =
  772.         {
  773.             G_TYPE,
  774.             G_NAME,
  775.             G_OWNER,
  776.             G_HELP,
  777.             G_INTERNATIONAL_DB_BEGIN,
  778.             G_X,
  779.             G_Y,
  780.             G_WIDTH,
  781.             G_HEIGHT,
  782.             G_VALUE_X,
  783.             G_VALUE_Y,
  784.             G_ROWS,
  785.             G_INTERNATIONAL_DB_END,
  786.             G_FOREGROUND_COLOR,
  787.             G_LABEL,
  788.             G_TITLE,
  789.             G_LABEL_TYPE,
  790.             G_LAYOUT_TYPE,
  791.             G_READ_ONLY,
  792.             G_MULTIPLE_SELECTIONS,
  793.             G_SELECTION_REQUIRED,
  794.             G_INITIAL_STATE,
  795.             G_DROPPABLE,
  796.             G_DEFAULT_DROP_SITE,
  797.             G_MENU_NAME,
  798.             G_NOTIFY_HANDLER,
  799.             G_EVENT_HANDLER,
  800.             G_EVENTS,
  801.             G_INITIAL_LIST_VALUES,
  802.             G_INITIAL_LIST_GLYPHS,
  803.             G_INITIAL_SELECTIONS,
  804.             G_USER_DATA,
  805.             G_ACTIONS,
  806.             -1,
  807.         };
  808.         
  809.         return attrs;
  810.     }
  811.  
  812.     case G_SETTING:
  813.     {
  814.         static G_ATTRS  attrs[] =
  815.         {
  816.             G_TYPE,
  817.             G_NAME,
  818.             G_OWNER,
  819.             G_HELP,
  820.             G_INTERNATIONAL_DB_BEGIN,
  821.             G_X,
  822.             G_Y,
  823.             G_WIDTH,
  824.             G_HEIGHT,
  825.             G_VALUE_X,
  826.             G_VALUE_Y,
  827.             G_ROWS,
  828.             G_COLUMNS,
  829.             G_INTERNATIONAL_DB_END,
  830.             G_LAYOUT_TYPE,
  831.             G_FOREGROUND_COLOR,
  832.             G_SETTING_TYPE,
  833.             G_SELECTION_REQUIRED,
  834.             G_LABEL,
  835.             G_LABEL_TYPE,
  836.             G_NOTIFY_HANDLER,
  837.             G_EVENT_HANDLER,
  838.             G_EVENTS,
  839.             G_CHOICES,
  840.             G_CHOICE_LABEL_TYPES,
  841.             G_CHOICE_COLORS,
  842.             G_CHOICE_DEFAULTS,
  843.             G_INITIAL_SELECTIONS,
  844.             G_INITIAL_STATE,
  845.             G_USER_DATA,
  846.             G_ACTIONS,
  847.             -1,
  848.         };
  849.         
  850.         return attrs;
  851.     }
  852.         
  853.     case G_SLIDER:
  854.     {
  855.         static G_ATTRS  attrs[] =
  856.         {
  857.             G_TYPE,
  858.             G_NAME,
  859.             G_OWNER,
  860.             G_HELP,
  861.             G_INTERNATIONAL_DB_BEGIN,
  862.             G_X,
  863.             G_Y,
  864.             G_WIDTH,
  865.             G_HEIGHT,
  866.             G_VALUE_X,
  867.             G_VALUE_Y,
  868.             G_SLIDER_WIDTH,
  869.             G_TICKS,
  870.             G_INTERNATIONAL_DB_END,
  871.             G_FOREGROUND_COLOR,
  872.             G_LABEL,
  873.             G_LABEL_TYPE,
  874.             G_LAYOUT_TYPE,
  875.             G_ORIENTATION,
  876.             G_SHOW_ENDBOXES,
  877.             G_SHOW_RANGE,
  878.             G_SHOW_VALUE,
  879.             G_MIN_VALUE,
  880.             G_MAX_VALUE,
  881.             G_MIN_VALUE_STRING,
  882.             G_MAX_VALUE_STRING,
  883.             G_MIN_TICK_STRING,
  884.             G_MAX_TICK_STRING,
  885.             G_INITIAL_VALUE,
  886.             G_INITIAL_STATE,
  887.             G_NOTIFY_HANDLER,
  888.             G_EVENT_HANDLER,
  889.             G_EVENTS,
  890.             G_USER_DATA,
  891.             G_ACTIONS,
  892.             -1,
  893.         };
  894.         
  895.         return attrs;
  896.     }
  897.  
  898.     case G_STACK:
  899.     {
  900.         static G_ATTRS  attrs[] =
  901.         {
  902.             G_TYPE,
  903.             G_NAME,
  904.             G_OWNER,
  905.             G_MEMBERS,
  906.             G_USER_DATA,
  907.             -1,
  908.         };
  909.         
  910.         return attrs;
  911.     }
  912.  
  913.     case G_TERM_PANE:
  914.     {
  915.         static G_ATTRS  attrs[] =
  916.         {
  917.             G_TYPE,
  918.             G_NAME,
  919.             G_OWNER,
  920.             G_HELP,
  921.             G_INTERNATIONAL_DB_BEGIN,
  922.             G_X,
  923.             G_Y,
  924.             G_WIDTH,
  925.             G_HEIGHT,
  926.             G_INTERNATIONAL_DB_END,
  927.             G_BACKGROUND_COLOR,
  928.             G_FOREGROUND_COLOR,
  929.             G_INITIAL_STATE,
  930.             G_SHOW_BORDER,
  931.             G_EVENT_HANDLER,
  932.             G_EVENTS,
  933.             G_USER_DATA,
  934.             G_ACTIONS,
  935.             -1,
  936.         };
  937.         return attrs;
  938.     }
  939.  
  940.     case G_TEXT_FIELD:
  941.     {
  942.         static G_ATTRS  attrs[] =
  943.         {
  944.             G_TYPE,
  945.             G_NAME,
  946.             G_OWNER,
  947.             G_HELP,
  948.             G_INTERNATIONAL_DB_BEGIN,
  949.             G_X,
  950.             G_Y,
  951.             G_WIDTH,
  952.             G_HEIGHT,
  953.             G_VALUE_X,
  954.             G_VALUE_Y,
  955.             G_VALUE_LENGTH,
  956.             G_STORED_LENGTH,
  957.             G_ROWS,
  958.             G_INTERNATIONAL_DB_END,
  959.             G_FOREGROUND_COLOR,
  960.             G_TEXT_TYPE,
  961.             G_LABEL,
  962.             G_LABEL_TYPE,
  963.             G_LAYOUT_TYPE,
  964.             G_VALUE_UNDERLINED,
  965.             G_MAX_VALUE,
  966.             G_MIN_VALUE,
  967.             G_INITIAL_VALUE,
  968.             G_INITIAL_STATE,
  969.             G_READ_ONLY,
  970.             G_NOTIFY_HANDLER,
  971.             G_EVENT_HANDLER,
  972.             G_EVENTS,
  973.             G_USER_DATA,
  974.             G_ACTIONS,
  975.             -1,
  976.         };
  977.         
  978.         return attrs;
  979.     }
  980.         
  981.     case G_TEXT_PANE:
  982.     {
  983.         static G_ATTRS  attrs[] =
  984.         {
  985.             G_TYPE,
  986.             G_NAME,
  987.             G_OWNER,
  988.             G_HELP,
  989.             G_INTERNATIONAL_DB_BEGIN,
  990.             G_X,
  991.             G_Y,
  992.             G_WIDTH,
  993.             G_HEIGHT,
  994.             G_INTERNATIONAL_DB_END,
  995.             G_BACKGROUND_COLOR,
  996.             G_FOREGROUND_COLOR,
  997.             G_INITIAL_STATE,
  998.             G_SHOW_BORDER,
  999.             G_READ_ONLY,
  1000.             G_EVENT_HANDLER,
  1001.             G_EVENTS,
  1002.             G_USER_DATA,
  1003.             G_ACTIONS,
  1004.             -1,
  1005.         };
  1006.         return attrs;
  1007.     }
  1008.  
  1009.     default:
  1010.     {
  1011.         static G_ATTRS  attrs[] =
  1012.         {
  1013.             G_TYPE,
  1014.             G_NAME,
  1015.             G_OWNER,
  1016.             G_HELP,
  1017.             G_EVENT_HANDLER,
  1018.             G_EVENTS,
  1019.             G_USER_DATA,
  1020.             G_ACTIONS,
  1021.             -1,
  1022.         };
  1023.         
  1024.         return attrs;
  1025.     }
  1026.     }
  1027. }
  1028.  
  1029.  
  1030. /*
  1031.  * Return a list of action attributes.
  1032.  */
  1033. G_ACTION_ATTRS        *
  1034. G_action_attrs()
  1035. {
  1036.     static G_ACTION_ATTRS  attrs[] =
  1037.     {
  1038.         G_ACTION_FROM,
  1039.         G_ACTION_WHEN,
  1040.         G_ACTION_TO,
  1041.         G_ACTION_FUNC_TYPE,
  1042.         G_ACTION_ARG_TYPE,
  1043.         G_ACTION_OPERATION,
  1044.         -1,
  1045.     };
  1046.         
  1047.     return attrs;
  1048. }
  1049.  
  1050.  
  1051. /*
  1052.  * The list of attributes specifying the order of things written in the
  1053.  * project file.
  1054.  */
  1055. G_PROJ_ATTRS    *
  1056. G_project_attrs()
  1057. {
  1058.     static G_PROJ_ATTRS    proj_attrs[] =
  1059.     {
  1060.         G_INTERFACES,
  1061.         G_PROJ_ACTIONS,
  1062.         G_ROOT_WINDOW,
  1063.         -1,
  1064.     };
  1065.  
  1066.     return proj_attrs;
  1067. }
  1068.  
  1069.  
  1070. /*
  1071.  * Change an attribute into a string.  Returns a string.
  1072.  * 
  1073.  * REMIND: error checking.
  1074.  */
  1075. char           *
  1076. #ifdef __STDC__
  1077. G_attr_to_string(G_ATTRS attr)
  1078. #else
  1079. G_attr_to_string(attr)
  1080.     G_ATTRS         attr;
  1081. #endif
  1082. {
  1083.     return attr_string[attr];
  1084. }
  1085.  
  1086. /*
  1087.  * Change a string into an attribute.  Returns the attribute number if
  1088.  * successful, otherwise -1.
  1089.  */
  1090. G_ATTRS
  1091. #ifdef __STDC__
  1092. G_string_to_attr(char *s)
  1093. #else
  1094. G_string_to_attr(s)
  1095.     char           *s;
  1096. #endif
  1097. {
  1098.     return lookup(s, attr_string);
  1099. }
  1100.  
  1101.  
  1102. /*
  1103.  * Return the action string given a symbolic attribute.
  1104.  */
  1105. char    *
  1106. #ifdef __STDC__
  1107. G_action_attr_to_string(G_ACTION_ATTRS attr)
  1108. #else
  1109. G_action_attr_to_string(attr)
  1110.     G_ACTION_ATTRS    attr;
  1111. #endif
  1112. {
  1113.     return action_attr_string[attr];
  1114. }
  1115.  
  1116.  
  1117. /*
  1118.  * Return the action attribute given a string.
  1119.  */
  1120. G_ACTION_ATTRS
  1121. #ifdef __STDC__
  1122. G_string_to_action_attr(char *s)
  1123. #else
  1124. G_string_to_action_attr(s)
  1125.     char    *s;
  1126. #endif
  1127. {
  1128.     return lookup(s, action_attr_string);
  1129. }
  1130.  
  1131.  
  1132. /*
  1133.  * Returns the attribute string given the attribute number.
  1134.  */
  1135. char    *
  1136. #ifdef __STDC__
  1137. G_proj_attr_to_string(G_PROJ_ATTRS attr)
  1138. #else
  1139. G_proj_attr_to_string(attr)
  1140.     G_PROJ_ATTRS    attr;
  1141. #endif
  1142. {
  1143.     return proj_attr_string[attr];
  1144.  
  1145.  
  1146. /*
  1147.  * Change a string into an attribute.  Returns the attribute number if
  1148.  * successful, otherwise -1.
  1149.  */
  1150. G_PROJ_ATTRS
  1151. #ifdef __STDC__
  1152. G_string_to_proj_attr(char *s)
  1153. #else
  1154. G_string_to_proj_attr(s)
  1155.     char    *s;
  1156. #endif
  1157. {
  1158.     return lookup(s, proj_attr_string);
  1159. }
  1160.  
  1161.  
  1162. /*
  1163.  * Change a string into an attribute.  Returns the attribute number if
  1164.  * successful, otherwise -1.
  1165.  */
  1166. G_RESFILE_ATTRS
  1167. #ifdef __STDC__
  1168. G_string_to_resfile_attr(char *s)
  1169. #else
  1170. G_string_to_resfile_attr(s)
  1171.     char    *s;
  1172. #endif
  1173. {
  1174.     return lookup(s, resfile_attr_string);
  1175. }
  1176.  
  1177. /*
  1178.  * Change a string into an argument type.
  1179.  */
  1180. G_ARG_TYPES
  1181. #ifdef __STDC__
  1182. G_string_to_arg_type(char *s)
  1183. #else
  1184. G_string_to_arg_type(s)
  1185.     char    *s;
  1186. #endif
  1187. {
  1188.     return lookup(s, arg_type_string);
  1189. }
  1190.  
  1191. /*
  1192.  * Change a string into an function type.
  1193.  */
  1194. G_FUNC_TYPES
  1195. #ifdef __STDC__
  1196. G_string_to_func_type(char *s)
  1197. #else
  1198. G_string_to_func_type(s)
  1199.     char    *s;
  1200. #endif
  1201. {
  1202.     return lookup(s, func_type_string);
  1203. }
  1204.  
  1205. /*
  1206.  * Change a button type into a string.  Returns a string.
  1207.  * 
  1208.  * REMIND: error checking.
  1209.  */
  1210. char           *
  1211. #ifdef __STDC__
  1212. G_button_type_to_string(G_BUTTON_TYPES val)
  1213. #else
  1214. G_button_type_to_string(val)
  1215.     G_BUTTON_TYPES   val;
  1216. #endif
  1217. {
  1218.     return button_type_string[val];
  1219. }
  1220.  
  1221. /*
  1222.  * Change a string into a button type.
  1223.  */
  1224. G_BUTTON_TYPES
  1225. #ifdef __STDC__
  1226. G_string_to_button_type(char *s)
  1227. #else
  1228. G_string_to_button_type(s)
  1229.     char           *s;
  1230. #endif
  1231. {
  1232.     return lookup(s, button_type_string);
  1233. }
  1234.  
  1235. /*
  1236.  * Change a drawing model into a string.  Returns a string.
  1237.  * 
  1238.  * REMIND: error checking.
  1239.  */
  1240. char           *
  1241. #ifdef __STDC__
  1242. G_drawing_model_to_string(G_DRAWING_MODELS drawing_model)
  1243. #else
  1244. G_drawing_model_to_string(drawing_model)
  1245.     G_DRAWING_MODELS    drawing_model;
  1246. #endif
  1247. {
  1248.     return drawing_model_string[drawing_model];
  1249. }
  1250.  
  1251. /*
  1252.  * Change a string into an attribute.  Returns the attribute number if
  1253.  * successful, otherwise -1.
  1254.  */
  1255. G_DRAWING_MODELS
  1256. #ifdef __STDC__
  1257. G_string_to_drawing_model(char *s)
  1258. #else
  1259. G_string_to_drawing_model(s)
  1260.     char           *s;
  1261. #endif
  1262. {
  1263.     return lookup(s, drawing_model_string);
  1264. }
  1265.  
  1266. /*
  1267.  * Change an event type into a string.  Returns a string.
  1268.  * 
  1269.  * REMIND: error checking.
  1270.  */
  1271. char           *
  1272. #ifdef __STDC__
  1273. G_event_type_to_string(G_EVENT_TYPES event)
  1274. #else
  1275. G_event_type_to_string(event)
  1276.     G_EVENT_TYPES    event;
  1277. #endif
  1278. {
  1279.     return event_type_string[event];
  1280. }
  1281.  
  1282. /*
  1283.  * Change a string into an attribute.  Returns the attribute number if
  1284.  * successful, otherwise -1.
  1285.  */
  1286. G_EVENT_TYPES
  1287. #ifdef __STDC__
  1288. G_string_to_event_type(char *s)
  1289. #else
  1290. G_string_to_event_type(s)
  1291.     char           *s;
  1292. #endif
  1293. {
  1294.     return lookup(s, event_type_string);
  1295. }
  1296.  
  1297. /*
  1298.  * Change a label type into a string.  Returns a string.
  1299.  * 
  1300.  * REMIND: error checking.
  1301.  */
  1302. char           *
  1303. #ifdef __STDC__
  1304. G_label_type_to_string(G_LABEL_TYPES val)
  1305. #else
  1306. G_label_type_to_string(val)
  1307.     G_LABEL_TYPES   val;
  1308. #endif
  1309. {
  1310.     return label_type_string[val];
  1311. }
  1312.  
  1313. /*
  1314.  * Change a string into a label type.
  1315.  */
  1316. G_LABEL_TYPES
  1317. #ifdef __STDC__
  1318. G_string_to_label_type(char *s)
  1319. #else
  1320. G_string_to_label_type(s)
  1321.     char           *s;
  1322. #endif
  1323. {
  1324.     return lookup(s, label_type_string);
  1325. }
  1326.  
  1327. /*
  1328.  * Change a layout type into a string.  Returns a string.
  1329.  * 
  1330.  * REMIND: error checking.
  1331.  */
  1332. char           *
  1333. #ifdef __STDC__
  1334. G_layout_type_to_string(G_LAYOUT_TYPES val)
  1335. #else
  1336. G_layout_type_to_string(val)
  1337.     G_LAYOUT_TYPES  val;
  1338. #endif
  1339. {
  1340.     return layout_type_string[val];
  1341. }
  1342.  
  1343. /*
  1344.  * Change a string into a layout type.
  1345.  */
  1346. G_LAYOUT_TYPES
  1347. #ifdef __STDC__
  1348. G_string_to_layout_type(char *s)
  1349. #else
  1350. G_string_to_layout_type(s)
  1351.     char           *s;
  1352. #endif
  1353. {
  1354.     return lookup(s, layout_type_string);
  1355. }
  1356.  
  1357. /*
  1358.  * Change a group type into a string.  Returns a string.
  1359.  * 
  1360.  * REMIND: error checking.
  1361.  */
  1362. char           *
  1363. #ifdef __STDC__
  1364. G_group_type_to_string(G_GROUP_TYPES val)
  1365. #else
  1366. G_group_type_to_string(val)
  1367.     G_GROUP_TYPES  val;
  1368. #endif
  1369. {
  1370.     return group_type_string[val];
  1371. }
  1372.  
  1373. /*
  1374.  * Change a string into a group type.
  1375.  */
  1376. G_GROUP_TYPES
  1377. #ifdef __STDC__
  1378. G_string_to_group_type(char *s)
  1379. #else
  1380. G_string_to_group_type(s)
  1381.     char           *s;
  1382. #endif
  1383. {
  1384.     return lookup(s, group_type_string);
  1385. }
  1386.  
  1387. /*
  1388.  * Change a reference point into a string.  Returns a string.
  1389.  * 
  1390.  * REMIND: error checking.
  1391.  */
  1392. char           *
  1393. #ifdef __STDC__
  1394. G_compass_point_to_string(G_COMPASS_POINTS val)
  1395. #else
  1396. G_compass_point_to_string(val)
  1397.     G_COMPASS_POINTS  val;
  1398. #endif
  1399. {
  1400.     return compass_point_string[val];
  1401. }
  1402.  
  1403. /*
  1404.  * Change a string into a group type.
  1405.  */
  1406. G_COMPASS_POINTS
  1407. #ifdef __STDC__
  1408. G_string_to_compass_point(char *s)
  1409. #else
  1410. G_string_to_compass_point(s)
  1411.     char           *s;
  1412. #endif
  1413. {
  1414.     return lookup(s, compass_point_string);
  1415. }
  1416.  
  1417. /*
  1418.  * Change a column alignment type into a string.  Returns a string.
  1419.  * 
  1420.  * REMIND: error checking.
  1421.  */
  1422. char           *
  1423. #ifdef __STDC__
  1424. G_col_alignment_to_string(G_COL_ALIGNMENTS val)
  1425. #else
  1426. G_col_alignment_to_string(val)
  1427.     G_COL_ALIGNMENTS  val;
  1428. #endif
  1429. {
  1430.     return col_alignment_string[val];
  1431. }
  1432.  
  1433. /*
  1434.  * Change a string into a column alignment type.
  1435.  */
  1436. G_COL_ALIGNMENTS
  1437. #ifdef __STDC__
  1438. G_string_to_col_alignment(char *s)
  1439. #else
  1440. G_string_to_col_alignment(s)
  1441.     char           *s;
  1442. #endif
  1443. {
  1444.     return lookup(s, col_alignment_string);
  1445. }
  1446.  
  1447. /*
  1448.  * Change a row alignment type into a string.  Returns a string.
  1449.  * 
  1450.  * REMIND: error checking.
  1451.  */
  1452. char           *
  1453. #ifdef __STDC__
  1454. G_row_alignment_to_string(G_ROW_ALIGNMENTS val)
  1455. #else
  1456. G_row_alignment_to_string(val)
  1457.     G_ROW_ALIGNMENTS  val;
  1458. #endif
  1459. {
  1460.     return row_alignment_string[val];
  1461. }
  1462.  
  1463. /*
  1464.  * Change a string into a row alignment type.
  1465.  */
  1466. G_ROW_ALIGNMENTS
  1467. #ifdef __STDC__
  1468. G_string_to_row_alignment(char *s)
  1469. #else
  1470. G_string_to_row_alignment(s)
  1471.     char           *s;
  1472. #endif
  1473. {
  1474.     return lookup(s, row_alignment_string);
  1475. }
  1476.  
  1477. /*
  1478.  * Change a menu type into a string.  Returns a string.
  1479.  * 
  1480.  * REMIND: error checking.
  1481.  */
  1482. char           *
  1483. #ifdef __STDC__
  1484. G_menu_type_to_string(G_MENU_TYPES val)
  1485. #else
  1486. G_menu_type_to_string(val)
  1487.     G_MENU_TYPES   val;
  1488. #endif
  1489. {
  1490.     return menu_type_string[val];
  1491. }
  1492.  
  1493. /*
  1494.  * Change a string into a menu type.
  1495.  */
  1496. G_MENU_TYPES
  1497. #ifdef __STDC__
  1498. G_string_to_menu_type(char *s)
  1499. #else
  1500. G_string_to_menu_type(s)
  1501.     char           *s;
  1502. #endif
  1503. {
  1504.     return lookup(s, menu_type_string);
  1505. }
  1506.  
  1507. /*
  1508.  * Change a setting type into a string.  Returns a string.
  1509.  * 
  1510.  * REMIND: error checking.
  1511.  */
  1512. char           *
  1513. #ifdef __STDC__
  1514. G_setting_type_to_string(G_SETTING_TYPES val)
  1515. #else
  1516. G_setting_type_to_string(val)
  1517.     G_SETTING_TYPES val;
  1518. #endif
  1519. {
  1520.     return setting_type_string[val];
  1521. }
  1522.  
  1523. /*
  1524.  * Change a string into a setting type.
  1525.  */
  1526. G_SETTING_TYPES
  1527. #ifdef __STDC__
  1528. G_string_to_setting_type(char *s)
  1529. #else
  1530. G_string_to_setting_type(s)
  1531.     char           *s;
  1532. #endif
  1533. {
  1534.     return lookup(s, setting_type_string);
  1535. }
  1536.  
  1537. /*
  1538.  * Change a setting type into a string.  Returns a string.
  1539.  * 
  1540.  * REMIND: error checking.
  1541.  */
  1542. char           *
  1543. #ifdef __STDC__
  1544. G_text_type_to_string(G_TEXT_TYPES val)
  1545. #else
  1546. G_text_type_to_string(val)
  1547.     G_TEXT_TYPES val;
  1548. #endif
  1549. {
  1550.     return text_type_string[val];
  1551. }
  1552.  
  1553.  
  1554. /*
  1555.  * Change a Initial State into a string.  Returns a string.
  1556.  * 
  1557.  */
  1558. char           *
  1559. #ifdef __STDC__
  1560. G_initial_state_to_string(G_INITIAL_STATES initial_state)
  1561. #else
  1562. G_initial_state_to_string(initial_state)
  1563.     G_INITIAL_STATES    initial_state;    
  1564. #endif
  1565. {
  1566.     return initial_state_string[initial_state];
  1567. }
  1568.  
  1569. /*
  1570.  * Change a string into an Initial State.  Returns the  Initial State
  1571.  * number if successful, otherwise -1.
  1572.  */
  1573. G_INITIAL_STATES
  1574. #ifdef __STDC__
  1575. G_string_to_initial_state(char *s)
  1576. #else
  1577. G_string_to_initial_state(s)
  1578.     char           *s;
  1579. #endif
  1580. {
  1581.     return lookup(s, initial_state_string);
  1582. }
  1583.  
  1584. /*
  1585.  * Change a string into a text type.
  1586.  */
  1587. G_TEXT_TYPES
  1588. #ifdef __STDC__
  1589. G_string_to_text_type(char *s)
  1590. #else
  1591. G_string_to_text_type(s)
  1592.     char           *s;
  1593. #endif
  1594. {
  1595.     return lookup(s, text_type_string);
  1596. }
  1597.  
  1598. /*
  1599.  * Change a type into a string.  Returns a string.
  1600.  * 
  1601.  * REMIND: error checking.
  1602.  */
  1603. char           *
  1604. #ifdef __STDC__
  1605. G_type_to_string(G_TYPES type)
  1606. #else
  1607. G_type_to_string(type)
  1608.     G_TYPES         type;
  1609. #endif
  1610. {
  1611.     return type_string[type];
  1612. }
  1613.  
  1614. /*
  1615.  * Change a string into a type.  Returns the type number if successful,
  1616.  * otherwise -1.
  1617.  */
  1618. G_TYPES
  1619. #ifdef __STDC__
  1620. G_string_to_type(char *s)
  1621. #else
  1622. G_string_to_type(s)
  1623.     char           *s;
  1624. #endif
  1625. {
  1626.     return lookup(s, type_string);
  1627. }
  1628.  
  1629. /*
  1630.  * Search for a string in the specified table.  Returns the table index if
  1631.  * successful, otherwise -1.
  1632.  */
  1633. static int
  1634. #ifdef __STDC__
  1635. lookup(char *s, char **tab)
  1636. #else
  1637. lookup(s, tab)
  1638.     char           *s;
  1639.     char          **tab;
  1640. #endif
  1641. {
  1642.     int             i;
  1643.  
  1644.     for (i = 0; tab[i]; i++)
  1645.         if (strcmp(s, tab[i]) == 0)
  1646.             return i;
  1647.     return -1;
  1648. }
  1649.